package com.testdemo.common.view;

import android.app.DialogFragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;

import com.testdemo.R;

import butterknife.Bind;
import butterknife.ButterKnife;

/***
 * @author ZhangXin
 * @time 2016/10/24 16:14
 * @decripe 进度条
 **/
public class ProgressDialogFragment extends DialogFragment {

    @Bind(R.id.circleView)
    CirclePercentView circleView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        getDialog().getWindow().setBackgroundDrawableResource(R.color.transparent);
        View view = inflater.inflate(R.layout.dialog_progress_fragment, container, false);
        ButterKnife.bind(this, view);
        return view;
    }


    public void setPercent(int percent) {
        circleView.setPercent(percent);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }
}
